package com.dingwen.treasure.business.controller;

import com.dingwen.treasure.base.controller.BaseViewController;
import com.dingwen.treasure.base.pojo.vo.Result;
import com.dingwen.treasure.core.annotation.RateLimiter;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * redis限流实现API
 *
 * @author dingwen
 * @date 2022/11/17
 */
@Api(tags = "redis限流实现API")
@RestController
@RequestMapping("redis")
public class RateLimiterController implements BaseViewController {

    @ApiOperation("redis限流测试")
    @RateLimiter(time = 1, count = 2)
    @GetMapping("/rate")
    public Result<String> rateLimiterSimpleTest() {
        return success();
    }
}
